package com.lhgray.sglhome.presentation.ui.compose

import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.itemsIndexed
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import com.lhgray.sglhome.domain.model.ListItemLabel

/**
 * 作者：lhgray on 2025/3/25.
 * 邮箱：lhgray@163.com
 * 文件：com.lhgray.sglhome.screen.compose
 */


@Preview(showBackground = true)
@Composable
fun OrderPreviewView() {
}

@Composable
fun LazyColumnOrder(orderList: List<ListItemLabel>) {
    Column(
        modifier = Modifier
            .fillMaxWidth()
            .padding(10.dp, 10.dp),
        verticalArrangement = Arrangement.Center,
        horizontalAlignment = Alignment.Start
    ) {
        LazyColumn {
            itemsIndexed(orderList) { _, item ->
                LazyColumnItemOrder(item)
            }
        }
    }
}

@Composable
fun LazyColumnItemOrder(listItemLabel: ListItemLabel?) {
    Row(Modifier.padding(5.dp, 7.dp, 5.dp, 7.dp)) {
        Text(
            (listItemLabel?.show_title + "  ") ?: "HAWB #: ",
            style = MaterialTheme.typography.bodyLarge
        )
        Text(listItemLabel?.item_text ?: "", style = MaterialTheme.typography.bodyLarge)
    }
}